import 'package:flutter/material.dart';
import 'package:flutter_app/http/DioRepository.dart';
import 'package:flutter_app/model/SearchComicsData.dart';

class ComicsTabViewModel extends ChangeNotifier{
  List<SearchComicsData> list = [];

  setList(List<SearchComicsData> newList){
    list.clear();
    list.addAll(newList);
    notifyListeners();
  }

  getComicsList(String text){
    DioRepository().searchComics("title", text, 1, 10,onSuccess: (rep){
      var searchData = BaseSearchComicsData.fromJson(rep);
      setList(searchData.data.data);
    });
  }
}